home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 11
/
CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso
/
propage
/
genies
/
donsgenies
/
don'sgenies
/
fitbitmaptobox.pprx
< prev
next >
Wrap
Text File
|
1993-05-25
|
1KB
|
53 lines
/* Fit image exactly into box, distorting as needed, assuming a screen resolution of 75 dpi in hi-res.
Written by Don Cox July '92 Not Public Domain. All rights reserved. */
signal on error
signal on syntax
address command
call ppm_AutoUpdate(0)
call SafeEndEdit.rexx()
oldunits = ppm_GetUnits()
call ppm_SetUnits(1)
box = ppm_ClickOnBox("Click on box...")
if box=0 then do
call ppm_Inform(1,"No box selected",)
call ppm_ClearStatus()
exit
end
boxtype = upper(word(ppm_GetBoxInfo(box), 1))
if boxtype~="BITMAP" then do
call ppm_Inform(1,"Not a bitmap box",)
call ppm_ClearStatus()
exit
end
size = ppm_GetBoxSize(box)
boxwidth = word(size,1)
boxheight = word(size,2)
margins = ppm_GetBoxMargins(box)
parse var margins mleft mtop mright mbottom
boxwidth = boxwidth-mleft-mright
boxheight = boxheight-mtop-mbottom
info = ppm_GetBoxInfo(box)
width = word(info,2)
height = word(info,3)
width = width/75 /* screen images at 75dpi for high res */
xscale = boxwidth/width
height = height/75
yscale = boxheight/height
call ppm_SetBoxScale(box,xscale,yscale)
call ppm_SetBoxOffset(box,0,0)
call ppm_SetUnits(oldunits)
call ppm_AutoUpdate(1)
exit